package com.sstock.smartstock;

import android.widget.EditText;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.view.KeyEvent;

public class LinedEditText extends EditText {
	  private Paint mPaint;
	  private OnEditModeExitListener onEditModeExitListener = null;

	  public LinedEditText(Context paramContext, AttributeSet paramAttributeSet)
	  {
	    super(paramContext, paramAttributeSet);
	    Paint localPaint1 = new Paint();
	    this.mPaint = localPaint1;
	    Paint localPaint2 = this.mPaint;
	    Paint.Style localStyle = Paint.Style.STROKE;
	    localPaint2.setStyle(localStyle);
	    this.mPaint.setARGB(100, 0, 0, 0);
	    setPadding(10, 0, 0, 0);
	  }

	  protected void onDraw(Canvas paramCanvas)
	  {
	    int i = getLineCount();
	    Paint localPaint = this.mPaint;
	    int j = getHeight();
	    int k = getLineHeight();
	    int m = j / k;
	    if (i < m)
	      i = m;
	    int n = 1;
	    while (true)
	    {
	      if (n >= i)
	      {
	        super.onDraw(paramCanvas);
	        return;
	      }
	      int i1 = n * k;
	      float f1 = getLeft();
	      float f2 = i1;
	      float f3 = getRight();
	      float f4 = i1;
	      paramCanvas.drawLine(f1, f2, f3, f4, localPaint);
	      n += 1;
	    }
	  }

	  public boolean onKeyPreIme(int paramInt, KeyEvent paramKeyEvent)
	  {
	    if ((paramInt == 4) && (paramKeyEvent.getAction() == 1) && (this.onEditModeExitListener != null))
	      this.onEditModeExitListener.onEditModeExit();
	    return super.onKeyPreIme(paramInt, paramKeyEvent);
	  }

	  public void setOnEditModeExitListener(OnEditModeExitListener paramOnEditModeExitListener)
	  {
	    this.onEditModeExitListener = paramOnEditModeExitListener;
	  }

	  public abstract interface OnEditModeExitListener
	  {
	    public abstract void onEditModeExit();
	  }
}
